/**
 * 
 */
package com.taobao.snowsnow.hibernate.service.impl;

import java.util.List;

import com.taobao.snowsnow.hibernate.dao.TradeRecordDao;
import com.taobao.snowsnow.hibernate.pojo.TradeRecord;
import com.taobao.snowsnow.hibernate.service.TradeRecordService;

/**
 * @author Tux
 *
 * 创建时间: 2011-4-29 上午09:55:17
 */
public class TradeRecordServiceImpl extends BaseServiceImpl implements TradeRecordService {
	private TradeRecordDao tdao;
	
	public List<TradeRecord> findAll() throws Exception {
		try {
			return tdao.findAll();
		} catch(Exception e) {
			e.printStackTrace();
			throw e;
		}
	}

	public TradeRecord findById(int id) throws Exception {
		try {
			return tdao.findById(id);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findById(int id)");
			throw e;
		}
	}
	
	public List<TradeRecord> findByName(String name) throws Exception {
		try {
			return tdao.findByName(name);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findByName(String name)");
			throw e;
		}
	}

	public long getTotal() throws Exception {
		try {
			return tdao.getTotal();
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at getTotal()");
			throw e;
		}
	}

	/* (non-Javadoc)
	 * @see com.taobao.snowsnow.hibernate.service.TradeRecordService#paging(int, int)
	 */
	public List<TradeRecord> paging(int page, int limit) throws Exception {
		try {
			return tdao.paging(page, limit);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at paging(int page, int limit)");
			throw e;
		}
	}

	public void setTdao(TradeRecordDao cdao) {
		this.tdao = cdao;
	}

	public TradeRecordDao getTdao() {
		return tdao;
	}

	@Override
	public TradeRecord getFirstObject() throws Exception {
		try {
			return tdao.getFirstObject();
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("TradeRecord getFirstObject()");
		}
		return null;
	}

	@Override
	public TradeRecord getLastObject() throws Exception {
		try {
			return tdao.getLastObject();
		} catch(Exception e) {
			e.printStackTrace();
			System.out.println("TradeRecord getLastObject()");
			throw e;
		}
	}

	@Override
	public TradeRecord findByNamePrecise(String name) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}
}
